import React, { Component } from 'react';

// 父组件
class Parent extends Component {
    state = {}
    sayHi = () => {
        console.log('sayHI');
    }
    render() {
        return (<div>
            Parnet
            <Child lastName="张"
                age={20}
                sayHi={this.sayHi}
                jsx={<div>这是传入的html结构，jsx</div>}
            ></Child>
        </div>);
    }
}

export default Parent;


// 子组件
class Child extends Component {
    state = {}
    render() {
        console.log(this.props);
        return (<div>
            Child <br />
            {this.props.lastName}
            {this.props.age}
            {this.props.jsx}
            {this.props.sayHi()}
        </div>);
    }
}
